<template>
	<!-- 已取消订单详情 -->
	<view class="container" v-if="isloding">
		<view class="top">
			<image src="../../../static/toux.png" mode=""></image>
			<view class="text">
				已取消订单，请重新发布
			</view>
		</view>
		<view class="mid">
			<view class="mid_title">
				<view class="time">
					开始时间：{{info.created_at}}
				</view>
				<view class="orderNumber">
					订单号：{{info.order_no}}
				</view>
			</view>
			<view class="address">
				<view class="qi">
					<image src="../../../static/icon/qidian.png" mode=""></image>
					<view class="qi_title">
						{{info.start}}
						<!-- <view class="qi_title_text">
							亚太商谷5栋-附24号
						</view> -->
					</view>
				</view>
				<view class="qi">
					<image src="../../../static/icon/zhongdian.png" mode=""></image>
					<view class="qi_title">
						{{info.end}}
						<!-- <view class="qi_title_text">
							亚太商谷5栋-附24号
						</view> -->
					</view>
				</view>
				<view class="openAddress" @tap="openAddress(info)">
					查看
				</view>
			</view>
			<view class="information">
				<view class="item">
					<image src="../../../static/icon/cheliang.png" mode=""></image>
					<view class="item_text" v-if="info.type==0">
						订单车型：吊运/{{name}}
					</view>
					<view class="item_text" v-if="info.type==1">
						订单车型：道路救援/{{name}}
					</view>
					<view class="item_text" v-if="info.type==2">
						订单车型：高空作业/{{name}}
					</view>
				</view>
				<view class="item">
					<image src="../../../static/icon/huowu.png" mode=""></image>
					<view class="item_text">
						货物信息：{{info.remark}}
					</view>
				</view>
				<view class="item">
					<image src="../../../static/icon/lianxiren.png" mode=""></image>
					<view class="item_text">
						联系人：{{info.consignee}}
					</view>
				</view>
				<view class="item">
					<image src="../../../static/phne.png" mode=""></image>
					<view class="item_text">
						联系人电话：{{info.consignee_phone}}
					</view>
				</view>
				<view class="item">
					<image src="../../../static/icon/yibiaopan.png" mode=""></image>
					<view class="item_text">
						预计公里：{{info.predistance/1000}}公里
					</view>
				</view>
				<view class="item">
					<image src="../../../static/icon/tixian.png" mode=""></image>
					<view class="item_text">
						预支付：￥ {{info.prepayment}}
					</view>
					<!-- <view class="mingxi">
						价格明细
					</view> -->
				</view>
				<view class="tips">
					（当前金额为预估价格，最终价格以实际里程数计算）
				</view>
			</view>
		</view>
		<view class="btn" @tap="goIndex">
			重新发布
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token:'',
				isloding:false,
				info:'',
				name:''
			};
		},
		onLoad(e) {
			this.token=e.token
			this.name=e.name
			uni.request({
				url: this.webUrl+'/user/job/read/'+e.id,
				method: 'GET',
				header:{
					token:e.token
				},
				data: {},
				success: res => {
					console.log(res)
					uni.hideLoading()
					this.isloding=true
					if(res.data.code==0){
						// this.phone=res.data.data.driver.phone
						this.info=res.data.data
					}else if(res.data.code==3){
						uni.showToast({
							title: res.data.msg,
							icon:'none',
							duration:2000
						});
					}else{
						uni.showToast({
							title: '网络错误',
							icon:'none',
							duration:2000
						});
					}
				},
				fail: () => {
					uni.showToast({
						title: '网络错误',
						icon:'none',
						duration:2000
					});
				},
				complete: () => {}
			});
		},
		methods:{
			goIndex(){
				uni.navigateTo({
					url: '../../index/index',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			openAddress(info){
				uni.navigateTo({
					url: '../map/map?info='+JSON.stringify(info),
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container{
		position: absolute;
		left: 0;
		bottom: 0;
		top: 0;
		right: 0;
		background: #f2f2f2;
		.top{
			margin-top: 22upx;
			display: flex;
			background: #FFFFFF;
			height: 120upx;
			image{
				width: 80upx;
				height: 80upx;
				margin: 20upx 28upx 20upx 30upx;
			}
			.text{
				font-size:36upx;
				line-height: 120upx;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:rgba(51,51,51,1);
			}
		}
		.mid{
			background: #FFFFFF;
			overflow: hidden;
			margin-top: 20upx;
			.mid_title{
				margin: 22upx 30upx 14upx;
				display: flex;
				font-size:24upx;
				justify-content: space-between;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:rgba(52,52,52,1);
			}
			.address{
				position: relative;
				margin: 0 30upx;
				border-bottom: 2upx solid #FFE9E2;
				border-top: 2upx solid #FFE9E2;
				.qi{
					margin-top: 26upx;
					padding-bottom: 28upx;
					display: flex;
					image{
						// margin-top: 4upx;
						width: 44upx;
						height: 44upx;
					}
					.qi_title{
						margin-left: 22upx;
						margin-top: 8upx;
						font-size:28upx;
						line-height: 28upx;
						font-family:Microsoft YaHei;
						font-weight:400;
						color:rgba(52,52,52,1);
						.qi_title_text{
							font-size:20upx;
							// line-height: 20upx;
							font-family:Microsoft YaHei;
							font-weight:400;
							color:rgba(102,102,102,1);
						}
					}
				}
				.openAddress{
					position: absolute;
					left: 616upx;
					top: 142upx;
					width: 74upx;
					height: 32upx;
					background: #FE5621;
					font-size:20upx;
					font-family:Microsoft YaHei;
					font-weight:400;
					color:rgba(253,252,252,1);
					border-radius:10upx;
					text-align: center;
					line-height: 32upx;
				}
			}
			.information{
				margin: 0upx 30upx;
				.item{
					position: relative;
					display: flex;
					font-size:24upx;
					font-family:Microsoft YaHei;
					font-weight:400;
					color:rgba(52,52,52,1);
					padding: 22upx 0;
					image{
						width: 40upx;
						margin-right: 22upx;
						height: 40upx;
					}
					.mingxi{
						position: absolute;
						right: 0;
					}
				}
				.tips{
					text-align: right;
					font-size:18upx;
					padding: 24upx 0;
					font-family:Microsoft YaHei;
					font-weight:400;
					color:rgba(102,102,102,1);
				}
			}
		}
		.btn{
			width: 100%;
			height: 80upx;
			position: absolute;
			bottom: 0;
			background: #FE5621;
			font-size:30upx;
			text-align: center;
			line-height: 80upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(252,252,252,1);
		}
	}
</style>
